home *** CD-ROM | disk | FTP | other *** search
- Path: fido.asd.sgi.com!austern
- From: "Nathan Myers <http://www.cantrip.org/>" <ncm@cantrip.org>
- Newsgroups: comp.programming.threads,comp.std.c++
- Subject: Re: Is C++ STL MT-Safe?
- Date: 18 Apr 1996 09:42:10 PDT
- Organization: Best Internet Communications
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <3175B960.3BCAE17D@cantrip.org>
- References: <4kmjvj$89t@usc.edu> <4kspmb$9tb@ubszh.fh.zh.ubs.com> <3173E95E.5AC@ix.netcom.com> <4l12rf$q11@galaxy.ucr.edu> <31753C02.58A6@ix.netcom.com>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Wed, 17 Apr 1996 20:39:12 -0700
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i386)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMXZw40y4NqrwXLNJAQHekgH+MvzzkErpeB6f2/qmRh+xpDO+sY+OC9mz
- aYDBVMAa37dO0Y8PYn/9GS9/jUiBxbGMd3q2ZqCaqZwWM35ys/5RRg==
- =xzJZ
- Originator: austern@isolde.mti.sgi.com
-
- David Brownell wrote:
- >
- > Tom Payne wrote:
- > >
- > > David Brownell (brownell@ix.netcom.com) wrote:
- > > :
- > > : Someone else mentioned Rogue Wave. Does anyone have URLS or something
- > > : through which the different "MT-enhanced" APIs could be compared? I've
- > > : been organizing a collection of MT/C++ issues; one of the gaps is where
- > > : the standard C++ library interfaces need to be "MT-safed" according to
- > > : some useful and consistent policy.
- > >
- > > Is there agreement on what is meant by the term "thread safe." (I have
- > > seen definitions that seemed quite inadequate.)
- >
- > IMHO "Thread-safe" is a misleading goal. You actually want an API that's
- > natural to use in a threaded environment ... in some cases, that means an
- > API that's OK to use from concurrent threads (e.g. add to containers),
- > but in other cases it's reasonable to have objects that are only usable
- > from a single thread (e.g. iterators).
-
- In this sense, STL (and the whole std library) is already MT-safe.
- Of course this depends on it being implemented properly, but there are
- no interfaces in the standard C++ library that cry out for "_r" versions,
- as were found in the C library. This is not accidental.
-
- This is not to say that the STL containers can be shared between threads
- without some kind of synchronization. Rather, it means that on a good
- implementation, two copies of a string which happen to share representation
- can be used by two threads, safely. In other words, what is shared invisibly
- is handled; what you can see is your responsibility.
-
- Nathan Myers
- ncm@cantrip.org http://www.cantrip.org/
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-